package huoye.shops.huoye.mine.presenter;

import android.util.Log;

import com.codeideology.android.lang.entity.Paging;
import com.codeideology.android.rpc.BaseJsonRequestCallback;
import com.codeideology.android.rpc.BooleanTypeAdapter;
import com.google.gson.GsonBuilder;

import java.util.List;

import huoye.shops.base.BasePresenter;
import huoye.shops.base.MineBaseJsonRequestCallback;
import huoye.shops.huoye.mine.model.PostDepositRec;
import huoye.shops.huoye.mine.model.ShopDetials;
import huoye.shops.huoye.mine.networt.MineService;
import huoye.shops.huoye.mine.view.IRecordPayRefreshView;


/**
 * Created by uesr on 2017/7/19.
 */

public class RecordPayPresenter extends BasePresenter<IRecordPayRefreshView> {

    private MineService mService;

    //收支记录
    public void getRecordPost(final Paging paging){
        //  view.showProcessingIndicator();
        mService.getRecordPost(paging, new MineBaseJsonRequestCallback<PostDepositRec>(PostDepositRec.class) {

            @Override
            public void onSuccess(List<PostDepositRec> list) {
                super.onSuccess(list);
                view.setDataSet(list,paging);
            }

            //网络请求失败
            @Override
            public void onFailure(String msg, String code, Throwable e) {
                super.onFailure(msg, code, e);
                view.makeToast(msg);
            }

            //加载结束
            @Override
            public void onNetworkFail() {
                super.onNetworkFail();
                view.onNetworkFail();
            }

            //加载中
            @Override
            public void onFinish() {
                super.onFinish();
                view.hideProcessingIndicator();
            }
        });
    }


    @Override
    public void onStart() {
        mService = new MineService();
    }
}
